'''
Created on 2012-3-26
类的继承
@author: computer
'''

class SchoolMember(object):
    '''
    classdocs
    '''

    def __init__(self,name,age):
        '''
        Constructor
        '''
        self.name=name
        self.age=age
        print(name+" 初始化成功 ")
        
    def tell(self):
        print(self.name+str(self.age))
        
        
class Student(SchoolMember):
    '''
                学生
    '''
    
    def __init__(self,name,age,mark):
        SchoolMember.__init__(self,name,age)
        
        self.mark = mark
          
    def tell(self):
        SchoolMember.tell(self)
        print("成绩是: "+str(self.mark))
        

class Teacher(SchoolMember):
    
    
    def __init__(self, name, age,salary):
        SchoolMember.__init__(self, name, age)
        self.salary = salary

    def tell(self):
        SchoolMember.tell(self)
        print('工资是：'+str(self.salary))
        
        
        
#sm = SchoolMember('张三',22)
#sm.tell()


st = Student('李四',22,100)

t = Teacher('王五',33,4999)

#把两个对象放到列表里，然后遍历列表，调用方法
members = [st,t]

for m in members:
    m.tell()

